<?php
/**
 * ============================================================================
 * Doxt Version: 1.0           杭州多讯科技有限公司
 * Web: http://www.doxt.com
 * Copyright (C) 2007 - 2010 Doxt Technology Inc., All Rights Reserved.
 * ---------------------------------------------
 * $Date: 2008.4.8
*/

    $cate_id = intval( $_POST["cate_id"] ); //分类
	$news_id = intval( $_POST['news_id']); //新闻id
	$date = $_POST['date'];	//时间
	if (empty($cate_id))
	{
	   MyNotice("請選擇分类");
	   exit(0);
	} //End if

    $zh_headline = work_str($_POST["zh_headline"], 1);			//中文标题

    $search = "SELECT * FROM $TBL_HOUSE WHERE id<>'$news_id' AND zh_headline='$zh_headline'";
	$result = mysql_query( $search );
	if( @mysql_num_rows( $result ) > 0 )
	{
		MyNotice("以该标题命名的文章已存在,请换个标题试试!");
		exit();
	}
    $zh_keywords = work_str($_POST["zh_keywords"], 1);			//中文关键字

	$zh_text = work_str($_POST["chinese_edit"], 1);				//中文内容
	$cont1 = array("<p>","</p>");
	$cont2 = array("","</br>");
	$zh_text1 = str_replace($cont1, $cont2, $zh_text);
	$author=work_str($_POST['author'],1);						//作者
	$sorting=(int)$_POST['sorting'];						//排列顺序
	$price=work_str($_POST['price'],1);

	$sql_up="select * from $TBL_HOU_CATE where cate_id='$cate_id'";
	$result_up=mysql_query($sql_up);
	$row_up=mysql_fetch_array($result_up);
	$cate_name= $row_up['zh_cate_title'];

	$query = "UPDATE $TBL_NEWS SET cate_id='$cate_id',zh_headline='$zh_headline',price='$price',zh_keywords='$zh_keywords',sorting='$sorting',zh_text='$zh_text1',date_up='".get_Now()."',cate_name='$cate_name',author='$author' WHERE id=" . $news_id;
	$res = mysql_query($query) or die(mysql_error());
	MyNotice("文章修改成功!",2,"news.php");
	exit(0);
?>